<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>on event</title>
</head>

<body>
    <div><button onclick="test()">onclick</button></div>

</body>
<style>
    div {
        width: 100px;
        height: 100px;
        /* background-color: red; */
    }

    button {
        width: 100px;
        height: 50px;
    }
</style>
<script>
    function test() {
        console.log("test")
    }
</script>

</html>